plugins {
    id 'org.jetbrains.kotlin.js' version '1.5.20'
    id 'org.jetbrains.kotlin.plugin.serialization' version '1.5.20'
}

group 'me.mementomorri'
version '1.0-SNAPSHOT'

def kotlinVersion = "1.5.20"
def reactVersion = "17.0.2"
def suffix = "-pre.213-kotlin-"
def ktor_version = "1.6.0"
def kotlinReactVersion = reactVersion + suffix + kotlinVersion
def kotlinReactRouterVersion = "5.2.0" + suffix + kotlinVersion

repositories {
    mavenCentral()
    jcenter()
    maven { url "https://kotlin.bintray.com/kotlin-js-wrappers" }
    maven { url "https://kotlin.bintray.com/kotlinx" }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
    implementation "org.jetbrains.kotlin-wrappers:kotlin-react:$kotlinReactVersion"
    implementation "org.jetbrains.kotlin-wrappers:kotlin-react-dom:$kotlinReactVersion"
    implementation "org.jetbrains.kotlin-wrappers:kotlin-react-router-dom:$kotlinReactRouterVersion"
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
    implementation "io.ktor:ktor-client-js:$ktor_version"
    implementation "io.ktor:ktor-client-serialization:$ktor_version"
    implementation "io.ktor:ktor-client-core:$ktor_version"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0"
    testImplementation "org.jetbrains.kotlin:kotlin-test-js"
}

kotlin {
    target.browser {}
    sourceSets["main"].dependencies {
        implementation(npm("react", "17.0.2"))
        implementation(npm("react-dom", "17.0.2"))
        implementation(npm("react-router-dom", "5.2.0"))
    }
}
